#ifndef DATAMODEL_H
#define DATAMODEL_H

#include <QAbstractTableModel>
#include <QList>
#include "Download.h"

class DataModel : public QAbstractTableModel
{
	Q_OBJECT

	QList<Download*> downloads;
public:
	enum Columns {
		IdColumn = 0,
		LinkColumn = 1,
		FolderColumn = 2,
		PriorityColumn = 3,
		ProgressColumn = 4
	};


	explicit DataModel(QObject *parent = 0);

	int rowCount(const QModelIndex &parent) const;
	int columnCount(const QModelIndex &parent) const;
	QVariant data(const QModelIndex &index, int role) const;
	void removeRow(int index);
	Download *getDownloadToStart();
	bool isDuplicateDownload(QString folder, QString file);
	void removeDownload(int downloadId);
	void stopDownload(int downloadId);
	Download *getDownload(int downloadId);

signals:
	
public slots:
	void addDownload(Download *newDownload);
	void save();
	void update();
};

#endif // DATAMODEL_H
